package com.sino.operation.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sino.operation.entity.SysOrganization;
import com.sino.operation.mapper.SysOrganizationMapper;
import com.sino.operation.service.SysOrganizationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @Title: SysOrganizationServiceImpl
 * @Description:
 * @Author dengls
 * @date 2021/10/12 15:09
 */
@Service
public class SysOrganizationServiceImpl extends ServiceImpl<SysOrganizationMapper, SysOrganization> implements SysOrganizationService {
    @Autowired(required = false)
    private SysOrganizationMapper sysOrganizationMapper;

    @Override
    public IPage<SysOrganization> selectList(Map<String, String> map) {
        QueryWrapper<SysOrganization> wrapper = new QueryWrapper<>();
        if (map.containsKey("organizationName") && map.get("organizationName") != null && !map.get("organizationName").trim().isEmpty()) {
            wrapper.eq("ORGANIZATION_NAME", map.get("organizationName"));
        }
        return sysOrganizationMapper.selectPage(new Page<>(Integer.parseInt(map.get("current")), Integer.parseInt(map.get("size"))), wrapper);
    }
}
